<?php

namespace App\Repository\Models;

use Illuminate\Database\Eloquent\Model;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;

/**
 * Class Action.
 *
 * @package namespace App\Repository\Models;
 */
class Action extends Model implements Transformable
{
    use TransformableTrait;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
//    protected $primaryKey='id';
    protected $fillable = ['id','group','name','action','description','menu_id','state'];
    
    // protected $hidden = ['id'];
    
    protected $appends = ['action_id'];

    public function getActionIdAttribute()
    {
       return $this->id; 
    }

    public function actionPermission()
    {
        return $this->hasOne(ActionPermission::class,'action_id','id');
    }
}
